import pymongo
import json

VERSION = 1002


def get_connect(host='localhost', port=27017, db='test'):
    return pymongo.MongoClient(host, port, db)


def _get_config(file='mongo.json'):
    with open(file, 'r') as config:
        return json.load(config)


def get_connect_from(file='mongo.json'):
    config = _get_config(file)
    client = pymongo.MongoClient(config['host'], config['port'])
    db = client[config['database']]
    return db


if __name__ == '__main__':
    print('请不要直接执行本脚本')
